package Structural.Flyweight.travel;


//具体行程
//具体享元角色
public class CrhTravel implements Travel {
    //这里的出发点和终点是内部状态，是固定的，不会改变，可以共享
    public String from;
    public String to;
    //等级和价格是外部状态，随客户端动态变化的，不可共享,接口的参数里面也说明了这一点
    public int level;
    public int price;

    public CrhTravel(String from, String to) {
        this.from = from;
        this.to = to;
    }

    @Override
    public void showDetailInfo(int level, int price) {
        this.level = level;
        this.price = price;
        System.out.println("购买从:" + from + " 到" + to + "的" + level + " 等高铁票+" + " ，价格为:" + price);
    }
}